package com.woniu.micropropertyserver.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.microcommonsserver.entity.RelativesInfoEntity;
import com.woniu.micropropertyserver.mapper.RelativesInfoMapper;
import com.woniu.micropropertyserver.service.IReletivesInfoService;
import com.woniu.micropropertyserver.util.PageRest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RelativesInfoServiceImpl  implements IReletivesInfoService {

    @Resource
   private RelativesInfoMapper relativesInfoMapper;

    @Override
    public List<RelativesInfoEntity> findall() {
        return null;
    }

    @Override
    public List<RelativesInfoEntity> findByoid(Long id) {
        return relativesInfoMapper.findByOwner(id);
    }

    @Override
    public RelativesInfoEntity findById(Long id) {
        return null;
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    public int updateInfo(RelativesInfoEntity relativesInfo) {
        return 0;
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    public int delInfo(Long id) {
        return 0;
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,rollbackFor = Exception.class)
    public Long saveInfo(RelativesInfoEntity relativesInfo) {
        return null;
    }

    @Override
    public PageInfo<RelativesInfoEntity> findAllByParams(PageRest pageRest, RelativesInfoEntity relativesInfo) {
        return PageHelper.startPage(pageRest.getPageNum(),pageRest.getPageSize()).doSelectPageInfo(()->relativesInfoMapper.findAllByParams(pageRest,relativesInfo));

    }

    @Override
    public RelativesInfoEntity findByCard(String id) {
        return relativesInfoMapper.findByCard(id);
    }

}
